package com.foredu.fiqs.persist.hibernate;

import java.util.List;
import com.foredu.fiqs.domain.Student;
import com.foredu.fiqs.persist.IStudentDao;

public class HibernateStudentDao extends HibernateAbstractDao<Student, Integer>
		implements IStudentDao {

	private static final long serialVersionUID = 1L;

	public HibernateStudentDao() {
		super(Student.class);
	}

	@SuppressWarnings("unchecked")
	@Override
	public Student findStudentByStuId(String id) {
		List<Student> studentList =  this.getHibernateTemplate().find("from Student s where s.stuId = ?", id);
		Student student = null;
		if (studentList != null && studentList.size() > 0) {
			student = studentList.get(0);
		}
		return student;
	}

}
